package com.shankar.narayan.ms.screen;

import com.shankar.narayan.ms.screen.TriangleType.Type;

/**
 * JUnit for TriangleType class. No 3rd party library is being used to include
 * any test framework. This JUnit would output the the result of the test to the
 * console. In traditional development and testing approach we would be able to
 * perform tests with assertions and other utilities that would help testing.
 * 
 */

public class TriangleTypeTest {

	public static void testCases() {
		// test 1. No value is set for the sides of the triangle.
		if (TriangleType.getTriangleType(null, null, null) == Type.ERROR
				.getType()) {
			System.out.println("Test 1: passed");
		}

		// test 2. Test if anything else is taken apart from integers
		if (TriangleType.getTriangleType(" ", "12", "10") == Type.ERROR
				.getType()) {
			System.out.println("Test 2: passed");
		}

		// test 3. Provide floating point values. Must accept only integers
		if (TriangleType.getTriangleType("12.1", "12.5", "12.6") == Type.ERROR
				.getType()) {
			System.out.println("Test 3: passed");
		}

		// test 4. Alpha numeric values
		if (TriangleType.getTriangleType("a3", "asdafgad", "adgaidgasd") == Type.ERROR
				.getType()) {
			System.out.println("Test 4: passed");
		}

		// test 4. Equilateral triangle
		if (TriangleType.getTriangleType("12", "12", "12") == Type.EQUILATERAL
				.getType()) {
			System.out.println("Test 5: passed");
		}

		// test 5. Isoceles triangle
		if (TriangleType.getTriangleType("12", "12", "10") == Type.ISOCELES
				.getType()) {
			System.out.println("Test 6: passed");
		}

		// test 6. Scalene triangle
		if (TriangleType.getTriangleType("11", "12", "10") == Type.SCALENE
				.getType()) {
			System.out.println("Test 7: passed");
		}
	}

	public static void main(String[] args) {
		testCases();
	}
}
